/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author A7med Kotb
 */
@Entity
@Table(name = "user_coupon")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UserCoupon.findAll", query = "SELECT u FROM UserCoupon u"),
    @NamedQuery(name = "UserCoupon.findByUcId", query = "SELECT u FROM UserCoupon u WHERE u.ucId = :ucId")})
public class UserCoupon implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "uc_id")
    private Integer ucId;
    @JoinColumn(name = "user_id", referencedColumnName = "id")
    @ManyToOne
    private User userId;
    @JoinColumn(name = "coupon_id", referencedColumnName = "c_id")
    @ManyToOne
    private Coupons couponId;

    public UserCoupon() {
    }

    public UserCoupon(Integer ucId) {
        this.ucId = ucId;
    }

    public Integer getUcId() {
        return ucId;
    }

    public void setUcId(Integer ucId) {
        this.ucId = ucId;
    }

    public User getUserId() {
        return userId;
    }

    public void setUserId(User userId) {
        this.userId = userId;
    }

    public Coupons getCouponId() {
        return couponId;
    }

    public void setCouponId(Coupons couponId) {
        this.couponId = couponId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ucId != null ? ucId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserCoupon)) {
            return false;
        }
        UserCoupon other = (UserCoupon) object;
        if ((this.ucId == null && other.ucId != null) || (this.ucId != null && !this.ucId.equals(other.ucId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojo.UserCoupon[ ucId=" + ucId + " ]";
    }
    
}
